// TOWN SCRIPT
//    Town 0: Magical Grove : A similacrumed town which is placed in many lands

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

int i,j,k,choice;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered.
	enable_add_chars(1);

set_crime_tolerance(2);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.

break;

beginstate 10;
	if (get_flag(0,0) == 250)
		end();
	message_dialog("You find a narrow, concealed walkway between two buildings. Webs hang from ceiling, and the bones of unfortunate rats crunch underfoot.","");
	set_flag(0,0,250);
break;

beginstate 11;
block_entry(1);
	reset_dialog();
	add_dialog_str(0,"Do you wish to leave the Valley now?",0);
	add_dialog_choice(0,"No");
	add_dialog_choice(1,"Yes");
	choice = run_dialog(1);
	if (choice == 1)
		end();
	if (choice == 2)
		set_state_continue(12);
break;

beginstate 12;
move_to_new_town(16,11,11);
message_dialog("You wake with a jump.","You're sitting on some chairs.");
break;

beginstate 75;
	if (get_flag(25,25) == 25)
		end();
	message_dialog("When you step nearer to the Portal a Guard walks up to you, and points at the podium. _You're reward's there._ he says.","");
	set_flag(25,25,25);
	break;

//beginstate 17;
//if (has_item(473))) 
//((item_type_in_slot(0,10) == 473) ||
//(item_type_in_slot(1,10) == 473) ||
//(item_type_in_slot(2,10) == 473) ||
//(item_type_in_slot(3,10) == 473)) {
//large_draw_pic_dialog(501,"PLACE","TEXT");
//large_draw_pic_dialog(501,"Suddenly, a flaring of magical energy surrounds you, and a group of powerful adventurers arrive.","After a short but heated argument, you give up the precious Bladesmaster Sword.");
//take_item(473);	}
//break;

beginstate 17;
	if (has_item(473)) {
		message_dialog("The Bladesmaster Sword begins to glow, and then starts to melt.","Soon it is nothing more than a lump of iron which you sadly toss aside. You would have very much liked to keep it.");
		take_item(473);
		}
			if ((item_type_in_slot(0,10) == 473) ||
	  (item_type_in_slot(1,10) == 473) ||
	  (item_type_in_slot(2,10) == 473) ||
	  (item_type_in_slot(3,10) == 473)) {
	  		  		  	  	}
break;